# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=python2-psycopg2
_pkgname=psycopg2
pkgver=2.8.6
pkgrel=4
pkgdesc='A PostgreSQL database adapter for the Python programming language.'
arch=('x86_64' 'aarch64')
url='https://pypi.org/project/psycopg2/#files'
license=('LGPL3')
depends=('python2' 'postgresql-libs')
makedepends=('python2-setuptools' 'postgresql-libs')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('1e1d5d8755c6d1a153d84210bf29902afafe853659d709e13abc6bc5772def13779d2394690af1c544384c9c607edc0fe5cf2763244fb346febf9a9e0032b45f')

prepare() {
  cd "$_pkgname-$pkgver"

  sed -i 's/,PSYCOPG_DEBUG$//' setup.cfg
}

build() {
  cd "$_pkgname-$pkgver"

  python2 setup.py build
}

package() {
  cd "$_pkgname-$pkgver"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

